<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>随机发放水果</title>
	</head>
	<body>
	<div>
	<input type="button" value="请选择" onclick="setColor()" />
		您本次得到的水果是: <span id="sp"></span>
	</div>
	<script language="JavaScript" type="text/javascript">
		function setColor(){
		var arr=["apple","banana","pear","lemon","peach"];
		var kind=Math.floor(Math.random()*(arr.length));
		document.getElementById("sp").innerHTML=arr[kind];
		}
	</script>	
	</body>
</html>
